/*
 * Copyright 2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mx.ymate.satoken.impl;

import com.mx.ymate.satoken.ISaToken;
import com.mx.ymate.satoken.ISaTokenConfig;
import net.ymate.platform.core.module.IModuleConfigurer;
import net.ymate.platform.core.module.impl.DefaultModuleConfigurable;

/**
 * DefaultSaTokenConfig generated By ModuleMojo on 2022/07/03 12:39
 *
 * @author YMP (https://www.ymate.net/)
 */
public final class DefaultSaTokenConfigurable extends DefaultModuleConfigurable {

    public static Builder builder() {
        return new Builder();
    }

    private DefaultSaTokenConfigurable() {
        super(ISaToken.MODULE_NAME);
    }

    public static final class Builder {

        private final DefaultSaTokenConfigurable configurable = new DefaultSaTokenConfigurable();

        private Builder() {
        }

        public Builder enabled(boolean enabled) {
            configurable.addConfig(ISaTokenConfig.ENABLED, String.valueOf(enabled));
            return this;
        }

        public Builder tokenName(String tokenName) {
            configurable.addConfig(ISaTokenConfig.TOKEN_NAME, tokenName);
            return this;
        }

        public Builder timeout(long timeout) {
            configurable.addConfig(ISaTokenConfig.TIMEOUT, String.valueOf(timeout));
            return this;
        }

        public Builder activityTimeout(long activityTimeout) {
            configurable.addConfig(ISaTokenConfig.ACTIVITY_TIMEOUT, String.valueOf(activityTimeout));
            return this;
        }

        public Builder concurrent(boolean concurrent) {
            configurable.addConfig(ISaTokenConfig.IS_CONCURRENT, String.valueOf(concurrent));
            return this;
        }

        public Builder share(boolean share) {
            configurable.addConfig(ISaTokenConfig.IS_SHARE, String.valueOf(share));
            return this;
        }

        public Builder maxLoginCount(int maxLoginCount) {
            configurable.addConfig(ISaTokenConfig.MAX_LOGIN_COUNT, String.valueOf(maxLoginCount));
            return this;
        }

        public Builder readBody(boolean readBody) {
            configurable.addConfig(ISaTokenConfig.IS_READ_BODY, String.valueOf(readBody));
            return this;
        }

        public Builder readHeader(boolean readHeader) {
            configurable.addConfig(ISaTokenConfig.IS_READ_HEADER, String.valueOf(readHeader));
            return this;
        }

        public Builder readCookie(boolean readCookie) {
            configurable.addConfig(ISaTokenConfig.IS_READ_COOKIE, String.valueOf(readCookie));
            return this;
        }

        public Builder writeHeader(boolean writeHeader) {
            configurable.addConfig(ISaTokenConfig.IS_WRITE_HEADER, String.valueOf(writeHeader));
            return this;
        }

        public Builder tokenStyle(String tokenStyle) {
            configurable.addConfig(ISaTokenConfig.TOKEN_STYLE, tokenStyle);
            return this;
        }

        public Builder dataRefreshPeriod(int dataRefreshPeriod) {
            configurable.addConfig(ISaTokenConfig.DATA_REFRESH_PERIOD, String.valueOf(dataRefreshPeriod));
            return this;
        }

        public Builder tokenSessionCheckLogin(boolean tokenSessionCheckLogin) {
            configurable.addConfig(ISaTokenConfig.TOKEN_SESSION_CHECK_LOGIN, String.valueOf(tokenSessionCheckLogin));
            return this;
        }

        public Builder autoRenew(boolean autoRenew) {
            configurable.addConfig(ISaTokenConfig.AUTO_RENEW, String.valueOf(autoRenew));
            return this;
        }

        public Builder tokenPrefix(String tokenPrefix) {
            configurable.addConfig(ISaTokenConfig.TOKEN_PREFIX, tokenPrefix);
            return this;
        }

        public Builder print(boolean print) {
            configurable.addConfig(ISaTokenConfig.IS_PRINT, String.valueOf(print));
            return this;
        }

        public Builder log(boolean log) {
            configurable.addConfig(ISaTokenConfig.IS_LOG, String.valueOf(log));
            return this;
        }

        public Builder logLevel(String logLevel) {
            configurable.addConfig(ISaTokenConfig.LOG_LEVEL, String.valueOf(logLevel));
            return this;
        }

        public Builder logLevelInt(int logLevelInt) {
            configurable.addConfig(ISaTokenConfig.LOG_LEVEL_INT, String.valueOf(logLevelInt));
            return this;
        }

        public Builder jwtSecretKey(String jwtSecretKey) {
            configurable.addConfig(ISaTokenConfig.JWT_SECRET_KEY, jwtSecretKey);
            return this;
        }

        public Builder basic(String basic) {
            configurable.addConfig(ISaTokenConfig.BASIC, basic);
            return this;
        }

        public Builder currDomain(String currDomain) {
            configurable.addConfig(ISaTokenConfig.CURR_DOMAIN, currDomain);
            return this;
        }

        public Builder sameTokenTimeout(long sameTokenTimeout) {
            configurable.addConfig(ISaTokenConfig.SAME_TOKEN_TIMEOUT, String.valueOf(sameTokenTimeout));
            return this;
        }

        public Builder cookieDomain(String cookieDomain) {
            configurable.addConfig(ISaTokenConfig.COOKIE_DOMAIN, cookieDomain);
            return this;
        }

        public Builder cookiePath(String cookiePath) {
            configurable.addConfig(ISaTokenConfig.COOKIE_PATH, cookiePath);
            return this;
        }

        public Builder cookieSecure(long cookieSecure) {
            configurable.addConfig(ISaTokenConfig.COOKIE_SECURE, String.valueOf(cookieSecure));
            return this;
        }


        public Builder cookieHttpOnly(long cookieHttpOnly) {
            configurable.addConfig(ISaTokenConfig.COOKIE_HTTP_ONLY, String.valueOf(cookieHttpOnly));
            return this;
        }

        public Builder cookieSameSite(String cookieSameSite) {
            configurable.addConfig(ISaTokenConfig.COOKIE_SAME_SITE, cookieSameSite);
            return this;
        }

        public IModuleConfigurer build() {
            return configurable.toModuleConfigurer();
        }
    }
}